import Vue from 'vue'
import VueRouter from 'vue-router'

// 新增地址
import Address from '../views/mine/childers/address/Address'
// 新增收货地址
import Saveress from '../views/mine/childers/saveress/Saveress'
const Class = () => import('../views/class/Class')
const Home = () => import('../views/home/Home')
const Shop = () => import('../views/shop/Shop')
const Mine = () => import('../views/mine/Mine')
const Phone = () => import('../views/home/home-phone/Phone')
const Details = () => import('../views/home/home-phone/details/Details')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    redirect: '/home/phone',
    children: [
      {
        path: 'phone',
        name: 'Phone',
        component: Phone
      }
    ]
  },
  {
    path: '/class',
    name: 'Class',
    component: Class
  },
  {
    path: '/details',
    name: 'Details',
    component: Details
  },
  {
    path: '/shop',
    name: 'Shop',
    component: Shop

  },
  {
    path: '/mine',
    name: 'Mine',
    component: Mine
  },
  {
    path: '/address',
    name: 'Address',
    component: Address
  },
  {
    path: '/saveress',
    name: 'Saveress',
    component: Saveress
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
